#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
double a[1007];
int main() {
	int n,m;
	while (~scanf("%d%d", &n, &m)){
		for (int i=0; i<1007; ++i) a[i]=0.0;
		vector<int> Array[n];
		double tmp[n];
		for (int i=0,len,t; i<n; ++i) {
			scanf("%lf%d", &tmp[i], &len);
			for (int j=0; j<len; ++j) {
				scanf("%d", &t);
				Array[i].push_back(t);
			}
		}
		int p;
		double b;
		for (int i=0; i<m; ++i) {
			scanf("%d%lf", &p, &b);
			if (a[p]<b) a[p]=b;
		}
		double res=0.0;
		for (int i=0; i<n; ++i) {
			int len=Array[i].size();
			double t=1.0;
			for (int j=0; j<len; ++j) t+=a[Array[i][j]];
			if (tmp[i]*t>res) res=tmp[i]*t;
		}
		printf("%0.4lf\n", res);
	}
	return 0;
} 

/*
3 6
120 3 1 2 3
100 4 1 2 3 4
110 3 2 3 4
1 0.12
2 0.23
2 0.26
4 0.57
3 0.35
5 0.41
*/
